(function(){"use strict";BX.namespace("BX.Landing.UI.Field");var t=BX.Landing.Utils.escapeHtml;var e=BX.Landing.Utils.isString;var i=BX.Landing.Utils.random;var n=BX.Landing.Utils.clone;var a=BX.Landing.Utils.fireCustomEvent;BX.Landing.UI.Field.BaseField=function(n){this.data=n;this.id="id"in n?n.id:i();this.selector=e(n.selector)?n.selector:i();this.content="content"in n?n.content:"";this.title=e(n.title)?n.title:"";this.placeholder=e(n.placeholder)?n.placeholder:"";this.className=e(n.className)?n.className:"";this.descriptionText=e(n.description)?n.description:"";this.attribute=e(n.attribute)?n.attribute:"";this.hidden=n.hidden?n.hidden:false;this.description=null;this.property=e(n.property)?n.property:"";this.style="style"in n?n.style:"";this.layout=BX.Landing.UI.Field.BaseField.createLayout();this.header=BX.Landing.UI.Field.BaseField.createHeader();this.header.innerHTML=t(this.title);this.layout.appendChild(this.header);this.input=this.createInput();this.layout.appendChild(this.input);this.layout.dataset.selector=this.selector;this.input.dataset.placeholder=this.placeholder;this.onValueChangeHandler=n.onValueChange?n.onValueChange:function(){};if(this.className){this.layout.classList.add(this.className)}if(this.descriptionText){this.description=BX.Landing.UI.Field.BaseField.createDescription(this.descriptionText);this.layout.appendChild(this.description)}this.input.addEventListener("paste",this.onPaste.bind(this));this.init()};BX.Landing.UI.Field.BaseField.createLayout=function(){return BX.create("div",{props:{className:"landing-ui-field"}})};BX.Landing.UI.Field.BaseField.createHeader=function(){return BX.create("div",{props:{className:"landing-ui-field-header"}})};BX.Landing.UI.Field.BaseField.createDescription=function(t){return BX.create("div",{props:{className:"landing-ui-field-description"},html:'<span class="fa fa-info-circle"></span>'+" "+t})};BX.Landing.UI.Field.BaseField.currentField=null;BX.Landing.UI.Field.BaseField.prototype={init:function(){},onPaste:function(t){t.preventDefault();var e;if(t.clipboardData&&t.clipboardData.getData){e=t.clipboardData.getData("text/plain");if(!this.textOnly){e=e.replace(new RegExp("\n","g"),"<br>")}document.execCommand("insertHTML",false,BX.Landing.Utils.escapeHtml(e))}else{e=window.clipboardData.getData("text");if(!this.textOnly){e=e.replace(new RegExp("\n","g"),"<br>")}document.execCommand("paste",true,BX.Landing.Utils.escapeHtml(e))}},createInput:function(){return BX.create("div",{props:{className:"landing-ui-field-input"},html:this.content})},getNode:function(){return this.layout},isChanged:function(){return(this.content===0?0:!!this.content?this.content.trim?this.content.trim():this.content:"")!==this.getValue()},getValue:function(){return this.input.innerHTML.trim()},setValue:function(e){e=e||"";e=this.textOnly?t(e):e;this.input.innerHTML=e.toString().trim();this.onValueChangeHandler(this);var i=new BX.Event.BaseEvent({data:{value:this.getValue()},compatData:[this.getValue()]});this.emit("change",i)},enable:function(){this.layout.disabled=false;this.layout.classList.remove("landing-ui-disable")},disable:function(){this.layout.disabled=true;this.layout.classList.add("landing-ui-disable")},reset:function(){},clone:function(t){return new this.constructor(n(t||this.data))}}})();
//# sourceMappingURL=base_field.map.js